package chz.emarket.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
//import org.apache.ibatis.annotations.Result;
//import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import chz.emarket.model.Person;

public interface PersonDao {
	
//	@Results({ 
//		@Result(property = "id", column = "id"), 
//		@Result(property = "userName", column = "userName"),
//		@Result(property = "password", column = "password"),
//		@Result(property = "nickName", column = "nickName"),
//		@Result(property = "userType", column = "userType")}
//	)
	@Select("SELECT * FROM person where userName=#{userName}")
	public Person getPersonByUserName(String userName);
	
	@Select("SELECT * FROM person where id=#{id}")
	public Person getPersonById(Integer id);
	
	@Select("SELECT * FROM person where userName=#{userName} and password=#{password}")
	public Person getPersonByUserNameAndPassword(@Param("userName")String userName, @Param("password")String password);
	
	@Select("SELECT count(*) FROM person where userName=#{userName} and password=#{password}")
	public Integer getMatchCount(@Param("userName")String userName, @Param("password")String password);
	
	@Select("SELECT * FROM person")
	public List<Person> getUserList();


}

